home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-03 | 22.5 KB | 837 lines | [TEXT/MPS ] |
- //----------------------------------------------------------------------------------------
- // UMenuView.cp
- // Copyright © 1984-96 by Apple Computer, Inc. All rights reserved.
- //----------------------------------------------------------------------------------------
-
- #ifndef __UMENUVIEW__
- #include "UMenuView.h"
- #endif
-
- // MacApp
-
- // #ifndef __UAPPLICATION__
- // #include "UApplication.h"
- // #endif
-
- #ifndef __UCOMMAND__
- #include "UCommand.h"
- #endif
-
- #ifndef __UDEBUG__
- #include "UDebug.h"
- #endif
-
- #ifndef __UDISPATCHER__
- #include "UDispatcher.h"
- #endif
-
- #ifndef __UDOCUMENT__
- #include "UDocument.h"
- #endif
-
- #ifndef __UEVENT__
- #include "UEvent.h"
- #endif
-
- #ifndef __UFAILURE__
- #include "UFailure.h"
- #endif
-
- #ifndef __UGEOMETRY__
- #include "UGeometry.h"
- #endif
-
- #ifndef __ULIST__
- #include "UList.h"
- #endif
-
- #ifndef __UMACAPPGLOBALS__
- #include "UMacAppGlobals.h"
- #endif
-
- #ifndef __UMACAPPUTILITIES__
- #include "UMacAppUtilities.h"
- #endif
-
- #ifndef __UMEMORY__
- #include "UMemory.h"
- #endif
-
- #ifndef __UMENUMGR__
- #include "UMenuMgr.h"
- #endif
-
- #ifndef __UPATCH__
- #include "UPatch.h"
- #endif
-
- // Toolbox
-
- #ifndef __DIALOGS__
- #include <Dialogs.h>
- #endif
-
- #ifndef __EDITIONS__
- #include <Editions.h>
- #endif
-
- #ifndef __ERRORS__
- #include <Errors.h>
- #endif
-
- #ifndef __TOOLUTILS__
- #include <ToolUtils.h>
- #endif
-
- // ANSI
-
- #if qDebugMsg
- #ifndef __STDIO__
- #include <stdio.h>
- #endif
- #endif
-
- //----------------------------------------------------------------------------------------
- Boolean gTrackingInMenu;
-
- //----------------------------------------------------------------------------------------
- struct MenuRec
- {
- ResNumber mID;
- TMenuView* mObject;
- };
-
-
- typedef MenuRec MenuArray[4000];
- typedef MenuRec* MenuArrayPtr;
- typedef MenuRec** MenuArrayHandle;
-
- //----------------------------------------------------------------------------------------
- static CGrafPort pMenuCPort; // Color port for compatibility. Private
- // grafPort used to focus the menu w/ o messing
- // up the Window Manager port.
- static MenuArrayHandle pMenuArray; // Used to map a MenuRef to the TMenuView
- static ResNumber pNumMenus;
- static Handle pCustDefproc; // Replaces the menu's menuProc field
-
-
- //========================================================================================
- // GLOBAL Procedures
- //========================================================================================
- static long Future(long delta);
- static void WaitTickChange();
- static TMenuView* FindTMenuView(MenuRef theMenu);
- static pascal void MenuDefproc(short message,
- MenuRef theMenu,
- CRect& menuRect,
- Point hitPt, // CW 5.5 thinks address is passed in if this is a CPoint!
- short& whichItem);
-
- #undef Inherited
-
- //----------------------------------------------------------------------------------------
- // Future: Returns the TickCount some time in the future.
- //----------------------------------------------------------------------------------------
- long Future(long delta)
- {
- return TickCount() + delta;
- } // Future
-
- //----------------------------------------------------------------------------------------
- // WaitTickChange:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- void WaitTickChange()
- {
- long now = TickCount();
- while (TickCount() != now)
- ;
- } // WaitTickChange
-
- //----------------------------------------------------------------------------------------
- // FindTMenuView:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- TMenuView* FindTMenuView(MenuRef theMenu)
- {
- MenuArrayPtr p = *pMenuArray;
- ResNumber id = (*theMenu)->menuID;
-
- for (ResNumber i = 0; i < pNumMenus; ++i)
- if (p[i].mID == id)
- return p[i].mObject;
- return NULL;
- } // FindTMenuView
-
- //----------------------------------------------------------------------------------------
- // MenuDefproc: Called by the MDEF resource.
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- pascal void MenuDefproc(short message,
- MenuRef theMenu,
- CRect& menuRect,
- Point hitPt, // CW 5.5 thinks address is passed in if this is a CPoint!
- short& whichItem)
-
- {
- long OldA5 = SetCurrentA5(); // ***** Called from trap patches *****
-
-
- TMenuView * menuObj = FindTMenuView(theMenu);
-
- if (menuObj != NULL)
- {
- CPoint fixedHitPt(hitPt);
- if (message == mPopUpMsg)
- { // The hitPt is not a point; its coordinates are switched (see TN#172).
- fixedHitPt.h = hitPt.v;
- fixedHitPt.v = hitPt.h;
- }
-
- // Dispatch to the TMenuView object
- menuObj->HandleDefproc(message, theMenu, menuRect, fixedHitPt, whichItem);
- }
- #if qDebug
- else
- ProgramBreak("MenuDefproc called with no TMenuView object");
- #endif
-
- SetA5(OldA5);
- } // MenuDefproc
-
- //----------------------------------------------------------------------------------------
- // InitUMenuView:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuInit
-
- void InitUMenuView()
-
- {
- if (qNeedsColorQD || HasColorQD())
- OpenCPort(&pMenuCPort);
- else
- OpenPort((GrafPtr) & pMenuCPort);
-
- pNumMenus = 0;
- pMenuArray = (MenuArrayHandle) NewPermHandle(0);
-
- #if qPowerPC
- RoutineDescriptorHandle h =
- (RoutineDescriptorHandle)NewPermHandle(sizeof(RoutineDescriptor));
-
- RoutineDescriptor aMDEFUPP = BUILD_ROUTINE_DESCRIPTOR(uppMenuDefProcInfo,MenuDefproc);
-
- ::BlockMove(&aMDEFUPP, *h, sizeof(RoutineDescriptor)); // leave BlockMove so cache flushes
- #else
- JmpInstructionTemplate** h =
- (JmpInstructionTemplate**) NewPermHandle(sizeof(JmpInstructionTemplate));
- PatchJmpInstruction(*h, (void*)StripLong(MenuDefproc));
- #endif
-
- pCustDefproc = (Handle) h;
- } // InitUMenuView
-
-
- //========================================================================================
- // CLASS TMenuView
- //========================================================================================
- #undef Inherited
- #define Inherited TView
-
- #pragma segment MAMenuInit
- MA_DEFINE_CLASS_M1(TMenuView, Inherited);
-
- //----------------------------------------------------------------------------------------
- // TMenuView constructor
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuInit
-
- TMenuView::TMenuView()
- {
- fBorder = gZeroRect;
- fFlashInterval = -1;
- fHighlighted = FALSE;
- fMenuRef = NULL;
- fNextFlash = 0;
- } // TMenuView::TMenuView
-
- //----------------------------------------------------------------------------------------
- // TMenuView destructor
- //----------------------------------------------------------------------------------------
- #pragma segment MADestructorRes
-
- TMenuView::~TMenuView()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // TMenuView::IMenuView:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuInit
-
- void TMenuView::IMenuView(ResNumber rsrcID,
- short menuWidth,
- short menuHeight)
-
- {
- VPoint itsSize(menuWidth, menuHeight);
-
- // Initialize fields
- this->IView(NULL, NULL, gZeroVPt, itsSize, sizeVariable, sizeVariable);
- fNextHandler = gDispatcher; // so postcommand flows to the app
-
- if (rsrcID != kNoResource)
- {
- MAVolatile(MenuRef, m);
- #if qDebugMsg
- MAVolatileInit(ResNumber, volatileRsrcID, rsrcID);
- #endif
-
- FailInfo fi;
- Try(fi)
- {
- // Read in menu and set its defproc
- m = MAGetMenu(rsrcID);
- FailNILResource((Handle)m);
-
- SetPermHandleSize((Handle) pMenuArray, sizeof(MenuRec) * (pNumMenus + 1));
- ++pNumMenus;
- fi.Success();
- }
- else
- {
- if (!m)
- { // FailNILResource failed
- #if qDebugMsg
- char msg[128];
-
- sprintf(msg, "No such Menu! (rsrcID = %4s)", (char *) &volatileRsrcID);
- ProgramBreak(msg);
- #endif
- }
- this->Free();
- fi.ReSignal();
- }
- (*pMenuArray)[pNumMenus-1].mID = (*m)->menuID;
- (*pMenuArray)[pNumMenus-1].mObject = this;
-
- (*m)->menuProc = pCustDefproc;
- fMenuRef = m;
-
- short item = 0;
- CRect itsRect(gZeroRect);
- MenuDefproc(mSizeMsg, m, itsRect, gZeroPt, item);// recompute the menu size
- }
- } // TMenuView::IMenuView
-
- //----------------------------------------------------------------------------------------
- // TMenuView::FindItem:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuNever
-
- short TMenuView::FindItem(CPoint)
-
- {
- return 0;
- } // TMenuView::FindItem
-
- //----------------------------------------------------------------------------------------
- // TMenuView::HandleDefproc:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- void TMenuView::HandleDefproc(short message,
- MenuRef theMenu,
- CRect& menuRect,
- CPoint hitPt,
- short& whichItem)
-
- {
- GrafPtr savePort;
-
- // Save the wmgr port && set our private port
- GetPort(&savePort);
-
- SetPort((GrafPtr) & pMenuCPort);
- // Match the location and size that the menu mgr gives us
- if ((message == mDrawMsg) || (message == mChooseMsg))
- {
- MovePortTo(menuRect.left, menuRect.top);
- PortSize(menuRect.GetLength(hSel), menuRect.GetLength(vSel));
- fLocation = menuRect[topLeft];
- }
-
- this->InvalidateCoordinates();
- if (this->Focus())
- {
- GlobalToLocal(hitPt);
- GlobalToLocal(menuRect[topLeft]);
- GlobalToLocal(menuRect[botRight]);
-
- this->SetEnable((((*theMenu)->enableFlags) & 1) != 0);
- switch (message)
- {
- case mDrawMsg:
- #if qDebugMsg
- if (gIntenseDebugging)
- fprintf(stderr, "mDrawMsg\n");
- #endif
-
- this->HandleDrawMessage(message, theMenu, menuRect, hitPt, whichItem);
- break;
-
- case mChooseMsg:
- #if qDebugMsg
- if (gIntenseDebugging)
- fprintf(stderr, "mChooseMsg\n");
- #endif
-
- this->HandleChooseMessage(message, theMenu, menuRect, hitPt, whichItem);
- break;
-
- case mSizeMsg:
- #if qDebugMsg
- if (gIntenseDebugging)
- fprintf(stderr, "mSizeMsg\n");
- #endif
-
- this->HandleSizeMessage(message, theMenu, menuRect, hitPt, whichItem);
- break;
-
- case mPopUpMsg:
- #if qDebugMsg
- if (gIntenseDebugging)
- fprintf(stderr, "mPopUpMsg\n");
- #endif
-
- this->HandlePopUpMessage(message, theMenu, menuRect, hitPt, whichItem);
- break;
-
- #if qDebugMsg
- default:
- if (gIntenseDebugging)
- fprintf(stderr, "otherwise message\n");
- break;
- #endif
-
- }
-
- LocalToGlobal(menuRect[topLeft]);
- LocalToGlobal(menuRect[botRight]);
-
- this->InvalidateFocus();
- }
-
- SetPort(savePort);
- } // TMenuView::HandleDefproc
-
- //----------------------------------------------------------------------------------------
- // TMenuView::HandleChooseMessage:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- void TMenuView::HandleChooseMessage(short /* message */,
- MenuRef /* theMenu */,
- CRect& /* menuRect */,
- CPoint hitPt,
- short& whichItem)
-
- {
- short newItem = kNoMenuItem;
- Boolean saveTrackingInMenu = gTrackingInMenu;
-
- // so that trackers get a chance to know that they're tracking in menus
- gTrackingInMenu = TRUE;
-
- if (this->IsEnabled()) // menu enabled
- {
- // see if CPoint is within hit area
- CRect hitRect = this->GetQDExtent() + fBorder;
-
- if (hitRect.Contains(hitPt)) // in menu (not border)
- {
- Boolean oldObjectPerm;
- TToolboxEvent * event = NULL;
- EventRecord theEventRecord;
-
- // NOTE: Either your subclass of TTearOffMenu should override DoMouseCommand
- // or one of TTearOffMenu's view's subview's should override DoMouseCommand so
- // that it creates and posts a TTracker. TTearOffMenu's override of
- // PostCommand will ensure that the tracker is tracked immediately. The
- // tracker, having been posted and tracked, will then get executed next time
- // PerformCommand is called. So, when we're done with HandleMouseDown below,
- // we simply tell the menu manager that no menu item was selected, ie
- // newItem == kNoMenuItem.
-
- theEventRecord.what = mouseDown;
- theEventRecord.message = 0;
- theEventRecord.when = TickCount();
- theEventRecord.where = hitPt;
- theEventRecord.modifiers = 0;
-
- if (Button())
- theEventRecord.modifiers |= btnState;
-
- if (IsCommandKeyDown())
- theEventRecord.modifiers |= cmdKey;
-
- if (IsOptionKeyDown())
- theEventRecord.modifiers |= optionKey;
-
- oldObjectPerm = AllocateObjectsFromPerm(FALSE);
- event = new TToolboxEvent;
- AllocateObjectsFromPerm(oldObjectPerm);
- event->IToolboxEvent(NULL, theEventRecord);
- event->fClickCount = gDispatcher->fClickCount;
- event->fAffectsMenus = FALSE;
-
- if (!HandleMouseDown(hitPt, event, gStdHysteresis))
- {
- // NOTE: for backwards compatibility with MacApp 2.0 - override your
- // TMenuView subclass' HandleMouseDown method to return false, and all
- // should work as before
-
- newItem = this->FindItem(hitPt);
- this->UpdateHighlight(whichItem, newItem);// Update highlighting
- }
- event = (TToolboxEvent *)FreeIfObject(event);
- }
- }
- else
- this->UpdateHighlight(whichItem, newItem); // Update highlighting
-
- gTrackingInMenu = saveTrackingInMenu;
-
- // Tell MenuManager about new item
- whichItem = newItem;
- } // TMenuView::HandleChooseMessage
-
- //----------------------------------------------------------------------------------------
- // TMenuView::HandleDrawMessage:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- void TMenuView::HandleDrawMessage(short /* message */,
- MenuRef /* theMenu */,
- CRect& /* menuRect */,
- CPoint /* hitPt */,
- short& /* whichItem */)
-
- {
- this->DrawContents();
- fHighlighted = FALSE;
- if (!IsEnabled())
- {
- PenPat(&qd.gray);
- PenMode(notSrcBic);
- PaintRect(&this->GetQDExtent());
- }
- } // TMenuView::HandleDrawMessage
-
- //----------------------------------------------------------------------------------------
- // TMenuView::HandleSizeMessage:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- void TMenuView::HandleSizeMessage(short /* message */,
- MenuRef theMenu,
- CRect& /* menuRect */,
- CPoint /* hitPt */,
- short& /* whichItem */)
-
- {
- VRect vr(this->GetFrame());
- this->ComputeFrame(vr);
- (*theMenu)->menuWidth = (short)vr.GetLength(hSel);
- (*theMenu)->menuHeight = (short)vr.GetLength(vSel);
- } // TMenuView::HandleSizeMessage
-
- //----------------------------------------------------------------------------------------
- // TMenuView::HandlePopUpMessage:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- void TMenuView::HandlePopUpMessage(short /* message */,
- MenuRef /* theMenu */,
- CRect& menuRect,
- CPoint hitPt,
- short& /* whichItem */)
-
- {
- VRect vr(this->GetExtent());
- this->ComputeFrame(vr);
- menuRect = this->ViewToQDRect(vr) + hitPt;
- } // TMenuView::HandlePopUpMessage
-
- //----------------------------------------------------------------------------------------
- // TMenuView::Highlight:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- void TMenuView::Highlight(short,
- Boolean)
-
- {
- this->SubClassResponsibility();
- } // TMenuView::Highlight
-
- //----------------------------------------------------------------------------------------
- // TMenuView::IsItemEnabled:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
- Boolean TMenuView::IsItemEnabled(short item)
-
- {
- return (*fMenuRef)->enableFlags & (1 << item);
- } // TMenuView::IsItemEnabled
-
- //----------------------------------------------------------------------------------------
- // TMenuView::GetMenuViewColors:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- void TMenuView::GetMenuViewColors(ResNumber theMenu,
- short theItem,
- MenuColors& theMenuColors)
-
- {
- enum TypeOfMenuInfo { aMenuItem, aMenuTitle, aMenuBar, noType };
-
-
- MCEntryPtr aMCEntryPtr;
- TypeOfMenuInfo typeOfRequest;
- TypeOfMenuInfo typeOfEntryFound;
- ResNumber theEntryMenu = theMenu;
- short theEntryItem = theItem;
-
- if (qNeedsColorQD || HasColorQD())
- {
- if (theItem)
- typeOfRequest = aMenuItem;
- else if (theMenu)
- typeOfRequest = aMenuTitle;
- else
- typeOfRequest = aMenuBar;
-
- aMCEntryPtr = GetMCEntry(theEntryMenu, theEntryItem);
- if (aMCEntryPtr == NULL) // not found, try as title
- {
- theEntryItem = 0;
- aMCEntryPtr = GetMCEntry(theEntryMenu, theEntryItem);
- if (aMCEntryPtr == NULL) // not found, try as menubar
- {
- theEntryMenu = 0;
- aMCEntryPtr = GetMCEntry(theEntryMenu, theEntryItem);
- }
- }
-
- if (aMCEntryPtr == NULL)
- typeOfEntryFound = noType;
- else
- {
- if (theEntryItem)
- typeOfEntryFound = aMenuItem;
- else if (theEntryMenu)
- typeOfEntryFound = aMenuTitle;
- else
- typeOfEntryFound = aMenuBar;
- }
-
- switch (typeOfEntryFound)
- {
- case aMenuItem:
- theMenuColors.itemColor = (*aMCEntryPtr).mctRGB1;
- theMenuColors.backgroundColor = (*aMCEntryPtr).mctRGB4;
- theMenuColors.markColor = (*aMCEntryPtr).mctRGB1;
- theMenuColors.commandColor = (*aMCEntryPtr).mctRGB1;
- break;
-
- case aMenuTitle:
- switch (typeOfRequest)
- {
- case aMenuItem:
- {
- theMenuColors.itemColor = (*aMCEntryPtr).mctRGB3;
- theMenuColors.backgroundColor = (*aMCEntryPtr).mctRGB4;
- theMenuColors.markColor = (*aMCEntryPtr).mctRGB3;
- theMenuColors.commandColor = (*aMCEntryPtr).mctRGB3;
- break;
- }
- case aMenuTitle:
- {
- theMenuColors.itemColor = (*aMCEntryPtr).mctRGB1;
- theMenuColors.backgroundColor = (*aMCEntryPtr).mctRGB2;
- theMenuColors.markColor = (*aMCEntryPtr).mctRGB1;
- theMenuColors.commandColor = (*aMCEntryPtr).mctRGB1;
- break;
- }
- }
- break;
-
- case aMenuBar:
- switch (typeOfRequest)
- {
- case aMenuItem:
- theMenuColors.itemColor = (*aMCEntryPtr).mctRGB3;
- theMenuColors.backgroundColor = (*aMCEntryPtr).mctRGB2;
- theMenuColors.markColor = (*aMCEntryPtr).mctRGB3;
- theMenuColors.commandColor = (*aMCEntryPtr).mctRGB3;
- break;
-
- case aMenuTitle:
- theMenuColors.itemColor = (*aMCEntryPtr).mctRGB1;
- theMenuColors.backgroundColor = (*aMCEntryPtr).mctRGB4;
- theMenuColors.markColor = (*aMCEntryPtr).mctRGB1;
- theMenuColors.commandColor = (*aMCEntryPtr).mctRGB1;
- break;
-
- case aMenuBar:
- theMenuColors.itemColor = (*aMCEntryPtr).mctRGB1;
- theMenuColors.backgroundColor = (*aMCEntryPtr).mctRGB4;
- theMenuColors.markColor = (*aMCEntryPtr).mctRGB1;
- theMenuColors.commandColor = (*aMCEntryPtr).mctRGB1;
- break;
-
- case noType:
- break;
- }
- break;
-
- case noType:
- theMenuColors.itemColor = gRGBBlack;
- theMenuColors.backgroundColor = gRGBWhite;
- theMenuColors.markColor = gRGBBlack;
- theMenuColors.commandColor = gRGBBlack;
- break;
- }
- }
- else
- {
- theMenuColors.itemColor = gRGBBlack;
- theMenuColors.backgroundColor = gRGBWhite;
- theMenuColors.markColor = gRGBBlack;
- theMenuColors.commandColor = gRGBBlack;
- }
- } // TMenuView::GetMenuViewColors
-
- //----------------------------------------------------------------------------------------
- // TMenuView::UpdateHighlight:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- void TMenuView::UpdateHighlight(short oldItem,
- short newItem)
-
- {
- // Update highlighting
- if (newItem == oldItem)
- {
- if (fFlashInterval >= 0)
- if (TickCount() > fNextFlash)
- {
- fHighlighted =!fHighlighted;
- this->Highlight(oldItem, fHighlighted);
- fNextFlash = Future(fFlashInterval);
- }
- }
- else
- {
- if (fHighlighted)
- if (oldItem != kNoMenuItem)
- this->Highlight(oldItem, FALSE);
-
- fHighlighted = (newItem != kNoMenuItem);
- if (fHighlighted)
- this->Highlight(newItem, TRUE);
-
- if (fFlashInterval >= 0)
- fNextFlash = Future(fFlashInterval);
- }
- } // TMenuView::UpdateHighlight
-
- //----------------------------------------------------------------------------------------
- // TMenuView::Focus:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- Boolean TMenuView::Focus() // override
-
- {
- VPoint vorigin;
- MenuColors theMenuColors;
-
- if (Inherited::Focus())
- {
- // Try to make the best match for the menu colors without requiring programmer
- // intervention. by setting the color environment to be for items.
-
- this->GetMenuViewColors((*fMenuRef)->menuID, 1, theMenuColors);
- SetIfColor(theMenuColors.itemColor);
- SetIfBkColor(theMenuColors.backgroundColor);
- return TRUE;
- }
- else
- return FALSE;
- } // TMenuView::Focus
-
- //----------------------------------------------------------------------------------------
- // TMenuView::IsShown:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- Boolean TMenuView::IsShown()
- {
- // Menu views do not always have superviews...
- if( fSuperView == NULL )
- return fShown;
- else
- return Inherited::IsShown();
- } // TMenuView::IsShown
-
- //----------------------------------------------------------------------------------------
- // TMenuView::IsActive:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- Boolean TMenuView::IsActive() // override
- {
- return TRUE; // if we are asking then we are active
- } // TMenuView::IsActive
-
- //----------------------------------------------------------------------------------------
- // TMenuView::FocusOnSuperView:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- Boolean TMenuView::FocusOnSuperView()// override
-
- {
- SetPort((GrafPtr) & pMenuCPort);
-
- CPoint qdOrigin(this->GetQDOrigin());
- SetOrigin(qdOrigin.h, qdOrigin.v);
-
- ClipRect(&(qd.thePort->portRect));
-
- return TRUE;
- } // TMenuView::FocusOnSuperView
-
- //----------------------------------------------------------------------------------------
- // TMenuView::GetGrafPort:
- //----------------------------------------------------------------------------------------
- #pragma segment MAMenuRes
-
- GrafPtr TMenuView::GetGrafPort() // override
-
- {
- return (GrafPtr) & pMenuCPort;
- } // TMenuView::GetGrafPort
-
- //----------------------------------------------------------------------------------------
- // End of UMenuView.cp
-
- #pragma segment Inline
-